package com.edgar.common.lib.app;

import android.app.Application;
import android.content.Context;

import com.edgar.baselibrary.AppGlobalContext;
import com.edgar.baselibrary.network.NetworkHelp;
import com.edgar.loglib.LogUtils;

/**
 * Created by edgar on 2015/11/14.
 */
public class CommonApplication extends Application{

    private Token mToken;
    @Override
    public void onCreate() {
        super.onCreate();
        Context context = getApplicationContext();
        AppGlobalContext.initialize(context);
        initLogAndCrashHandle(context);
        mToken = new Token(context);
        NetworkHelp.getInstance().init(context);
    }

    /**
     * Init print utils and crashHandle
     * @param context
     */
    private void initLogAndCrashHandle(Context context){
        LogUtils.initialize(context);
        CrashHandler.getInstance().init(context);
    }

    public Token getToken(){
        return mToken;
    }
}